<#import "spring.ftl" as spring />
<#setting number_format="0.##">
<#setting locale="en_US">
<link rel="stylesheet" href="${baseweb}/module/decorator/css/jquery-ui-1.8.13.custom.css" type="text/css" media="screen" />
<script type="text/javascript" src="${baseweb}/module/decorator/js/jquery-1.5.2.min.js"></script>
<script type='text/javascript' src="${baseweb}/module/decorator/js/jquery-tools.js"></script>
<script type="text/javascript" src="${baseweb}/module/decorator/js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="${baseweb}/module/decorator/js/addPaymentSetup.js"></script>
<div>
  <span style="color: #94A717; font-size: 1.3em; margin-right:5px">Cliente:</span><span>${command.customer.name}</span>
</div>
<#if result?has_content>
  <form action="addPayment.do" id="addPayment.do" method="POST"/>
  <input type="hidden" id="customerId" name="customerId" value="${command.customerId}"/>
  <table width='100%' border='0' class='results bottomMargin' id='summaryList'
      cellpadding='0' cellspacing='0'>
      <col width="4%" />
      <col width="16%" />
      <col width="20%" />
      <col width="20%" />
      <col width="20%" />
      <col width="20%" />
      <thead>
        <tr>
        <th>Select</th>
        <th>Id de Venta</th>
        <th>Fecha</th>
        <th>Total de la Venta</th>
        <th>Pagado</th>
        <th>Saldo</th>
        </tr>
      </thead>
      <tbody>
        <#list result as item>
          <tr>
            <td><input type="checkbox" id="check${item.saleId}" name="selection[${item.saleId}]" class="check"/></td>
            <td>${item.saleId}</td>
            <td>${item.saleDate}</td>
            <td>${item.saleTotal}</td>
            <td>${item.salePayed}</td>
            <td id="debt${item.saleId}" style="color:#FF0000">${item.saleDebt}</td>
          </tr>
        </#list>
    </tbody>
  </table>
<a href="#" id="addPaymentLink" >Mostrar opciones de pago</a>
<div id="paymentDiv" style="display:none; margin-top:5px;">
   <div class="saleSection">
     <span>Detalles de pago</span>
   </div>
	<div class="itemTemplate">
  	<span>
      	<label for="amount" style="color:#000000; font-weight:inherit;">Efectivo:</label>
      	<input type="text" id="amountCash" name="amountCash" value="0" style="text-align:right" size="5"/>
  	</span>
  	<span>
      	<label for="amount" style="color:#000000; font-weight:inherit;">Tarjeta Crédito:</label>
      	<input type="text" id="amountDebitCard" name="amountDebitCard" value="0" style="text-align:right" size="5"/>
  	</span>
  	<span>
      	<label for="amount" style="color:#000000; font-weight:inherit;" >Tarjeta Débito:</label>
      	<input type="text" id="amountCreditCard" name="amountCreditCard" value="0" style="text-align:right" size="5"/>
  	</span>
  	<#--@spring.formRadioButtons "command.paymentSelected", command.paymentTypes, ""/-->
	</div>
	<div class="saleSection" style="margin-top:5px;">
  		<span>Detalles de cheque</span>
	</div>
	<div id="checkOptions" class="itemTemplate">
  		<span>$ Valor:<input type="text" id="amountCheck" name="amountCheck" value="0"/></span>
  		<span>N° Cheque:<input type="text" id="numCheck" name="numCheck" value=""/></span>
  		<span>Fecha(dd-mm-yyyy):<input type="text" id="dateCheck" name="dateCheck" value=""/></span>
  		<span>Banco:<input type="text" id="bankCheck" name="bankCheck" value=""/></span>
	</div>
	<div class="saleSection">
  		<@spring.formRadioButtons "command.ticketTypeSelected", command.ticketTypes, ""/>
	</div>
	<div class="saleSection">
  		<span>Resumen de venta:</span>
  		<span>Total a Cta Cte:  $&nbsp;<input type="text" id="totalAccount" name="totalAccount" value="0" style="text-align:right" readonly="true"/></span>
  		<span>Total de Venta:  $&nbsp;<input type="text" id="totalSale" name="totalSale" value="0" style="text-align:right" readonly="true"/></span>
	</div>
  	<input type="submit" name="submit" value="Pagar"/>
</div>
</form>
<#else>
  No hay cuentas por pagar para el cliente seleccionado.
</#if>

